/*
 * Copyright 2017-8-30 13:56:25 The JA-SIG Collaborative. All rights reserved.
 * distributed with thi file and available online at
 */
package com.lap.scp.admin.core.impl;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lap.scd.commons.core.exception.ManagerException;
import com.lap.scd.commons.page.Page;
import com.lap.scp.admin.core.JobManager;
import com.lap.scp.admin.dal.JobDAO;
import com.lap.scp.admin.domain.JobDO;
import com.lap.scp.admin.query.JobQueryDO;

/**
 * <pre>
 * 职位业务管理
 * </pre>
 * 
 * @author 系统自动生成 Exp
 * @Date 2017-8-30 13:56:25
 * @since 1.0
 */
@Service("jobManager")
public class DefaultJobManager implements JobManager {

	@Resource
	private JobDAO jobDAO;

	@Override
	public int deleteById(int jobId) throws ManagerException {
		return jobDAO.deleteById(jobId);
	}

	@Override
	public void insertJob(JobDO jobDO) throws ManagerException {
		jobDAO.insertJob(jobDO);
	}

	@Override
	public JobDO queryById(int jobId) throws ManagerException {
		return jobDAO.queryById(jobId);
	}

	@Override
	public List<JobDO> queryPage(Page page, JobQueryDO queryDO) throws ManagerException {
		int count = jobDAO.countPage(queryDO);
		if (count <= 0) {
			return Collections.emptyList();
		} else {
			page.setTotalItem(count);
			return jobDAO.queryPage(page, queryDO);
		}
	}

	@Override
	public int updateJob(JobDO jobDO) throws ManagerException {
		return jobDAO.updateJob(jobDO);
	}

}
